package com.hue.client.controller;

import com.hue.client.service.impl.UserServiceImpl;
import com.hue.spring.annotation.Autowired;
import com.hue.spring.annotation.Controller;
import com.hue.spring.annotation.RequestMapping;
import com.hue.spring.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@Controller("userController")
@RequestMapping("/user")
public class UserController {
    @Autowired("userService")
    private UserServiceImpl userServiceImpl;

    @RequestMapping("/get")
    public void get(HttpServletRequest request, HttpServletResponse response,
                    @RequestParam("name") String name, @RequestParam("age") String age) {
        String str = userServiceImpl.test(name, age);
        PrintWriter writer = null;
        try {
            writer = response.getWriter();
            writer.write(str);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
